package celular;

import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;

public class Main extends MIDlet implements CommandListener
{
	private Display tela;
	private Form formMain;	
	private Command commandlogar, commandSair;
	private Ticker efeito   = null;  
	
	
	public Main()
	{		
		this.tela = Display.getDisplay(this);		
		
		formMain = new Form("Main");		
		
		
		formMain.addCommand(commandSair = new Command("Sair", Command.EXIT, 0));
		formMain.addCommand(commandlogar = new Command("Logar", Command.OK, 1));
		formMain.setCommandListener( this );
		
		formMain.setTicker(efeito = new Ticker("Sistema de Blog" ) );
	
	}
	

	
	public void startApp()
	{
		
		setCurrentMain();
	}
	
	public void pauseApp()
	{
	}
	
	public void destroyApp(boolean condicional)
	{

	}

	public void commandAction(Command c, Displayable d)
	{
		if (c == this.commandSair) {
			this.destroyApp(true);
			this.notifyDestroyed();
		}
		if (c == this.commandlogar) {
			
			this.tela.setCurrent(new FormLogin("Login",this));
		}
	}
	
		
	public Display getTela(){
		return this.tela;
	}
	
	public Form getMainForm(){
		return this.formMain;
	}
	
	
	public void setCurrentMain(){
		this.tela.setCurrent(new FormLogin("Login",this));
	}
}


